<div ng-cloak>

  <div uib-navbar profile="profile"></div>

  <div class="framework-main">
    <div uib-sidebar profile="profile" class="sidebar-full" is-collapse="roleview.isCollapse" groups="roleview.sidebarGroups" item-selected="roleview.sidebarSelected"></div>

    <div class="framework-body">
      <uib-breadcrumb class="breadcrumb-wrapper" breads="roleview.breads"></uib-breadcrumb>

      <div ng-if="type === 'create' && !loading">
        <div class="tools">
          <div class="btn-group" role="group" aria-label="">
            <a href="{{redirect_url}}" class="btn btn-default btn-info" uib-tooltip="返回" tooltip-append-to-body="true" tooltip-placement="top" ><i class="fa fa-fw fa-chevron-left"></i><span class="hidden-xs"> 返回</span></a>
          </div>
        </div>

        <div class="row mt-10">
          <div class="col-md-12">
            <div class="panel panel-default panel-csc">
              <div class="panel-heading">
                <div class="panel-title">新增角色</div>
              </div>
              <div class="panel-body">
                <form name="form" class="form form-horizontal" ng-submit="createSubmit(form.$valid)" novalidate>
                  <div class="form-group">
                    <label class="col-sm-2 control-label"><span class="span-danger">*</span>角色名称:</label>
                    <div class="col-sm-10">
                      <input type="text" ng-model="info.name" name="name" class="form-control" placeholder="角色名称" required>
                      <div class="error-messages" ng-messages="form.name.$error">
                        <small class="error" ng-message="required">请输入角色名称（*必填）</small>
                      </div>
                    </div>
                  </div>
                  <div class="form-group">
                    <label class="col-sm-2 control-label"><span class="span-danger">*</span>角色键值:</label>
                    <div class="col-sm-10">
                      <input type="text" ng-model="info.value" name="value" class="form-control" placeholder="角色键值" required>
                      <div class="error-messages" ng-messages="form.value.$error">
                        <small class="error" ng-message="required">请输入角色键值（*必填）</small>
                      </div>
                    </div>
                  </div>
                  <div class="form-group form-select-group">
                    <label class="col-sm-2 control-label"><span class="span-danger">*</span>角色描述:</label>
                    <div class="col-sm-10">
                      <textarea ng-model="info.desc" name="desc" class="form-control" placeholder="角色描述" required></textarea>
                      <div class="error-messages" ng-messages="form.desc.$error">
                        <small class="error" ng-message="required">请输入角色描述（*必填）</small>
                      </div>
                    </div>
                  </div>
                  <div class="form-group">
                    <label class="col-sm-2 control-label"><span class="span-danger">*</span>权限设置:</label>
                    <div class="col-sm-10">
                      <div uib-auth all-authes="authes" role-auth="info.authes"></div>
                    </div>
                  </div>

                  <div class="form-group">
                    <div class="col-sm-offset-2 col-sm-10">
                      <div class="btn-group" role="group" aria-label="">
                        <button class="btn btn-default btn-success" ng-disabled="form.$invalid"><i class="fa fa-fw fa-save"></i> 保存</button>
                      </div>
                      <div class="btn-group" role="group" aria-label="">
                        <a href="{{redirect_url}}" class="btn btn-default btn-danger"><i class="fa fa-fw fa-mail-forward"></i> 放弃</a>
                      </div>
                    </div>
                  </div>
                </form>
              </div>
            </div>
          </div>
        </div>
      </div>

      <div ng-if="type === 'view' && !loading">
        <div class="tools">
          <div class="btn-group" role="group" aria-label="">
            <a href="{{redirect_url}}" class="btn btn-default btn-info" uib-tooltip="返回" tooltip-append-to-body="true" tooltip-placement="top" ><i class="fa fa-fw fa-chevron-left"></i><span class="hidden-xs"> 返回</span></a>
          </div>
          <div ng-if="cfg.hasAuth(profile, cfg.api.role.update.url)" class="btn-group" role="group" aria-label="">
            <a ng-click="goview('roleview', 'edit', id) && info.ticket_status !== 3 && (cfg.hasRoleId(profile.roles,'1') || cfg.hasRoleId(profile.roles,'8') || (cfg.hasRoleId(profile.roles,'9') && info.status !== 1) || (cfg.hasRoleId(profile.roles,'10') && info.status !== 1))" class="btn btn-default btn-warning" uib-tooltip="编辑" tooltip-append-to-body="true" tooltip-placement="top" ><i class="fa fa-fw fa-edit"></i><span class="hidden-xs"> 编辑</span></a>
          </div>
          <!--<div ng-if="cfg.hasAuth(profile, cfg.api.role.delete.url)" class="btn-group" role="group" aria-label="">
            <a ng-click="deleteSubmit(id)" class="btn btn-default btn-danger" uib-tooltip="删除" tooltip-append-to-body="true" tooltip-placement="top" ><i class="fa fa-fw fa-trash"></i><span class="hidden-xs"> 删除</span></a>
          </div>-->
        </div>

        <div class="row mt-10">
          <div class="col-md-12">
            <div class="panel panel-default panel-csc">
              <div class="panel-heading">
                <div class="panel-title">查看角色</div>
              </div>
              <div class="panel-body">
                <div class="form form-horizontal">
                  <div class="form-group">
                    <label class="col-sm-2 control-label"><span class="span-danger">*</span>角色名称:</label>
                    <div class="col-sm-10">
                      <p class="form-control-static">{{info.name}}</p>
                    </div>
                  </div>
                  <div class="form-group">
                    <label class="col-sm-2 control-label"><span class="span-danger">*</span>角色键值:</label>
                    <div class="col-sm-10">
                      <p class="form-control-static">{{info.value || '未填写'}}</p>
                    </div>
                  </div>
                  <div class="form-group form-select-group">
                    <label class="col-sm-2 control-label"><span class="span-danger">*</span>角色描述:</label>
                    <div class="col-sm-10">
                      <p class="form-control-static">{{info.desc || '未填写'}}</p>
                    </div>
                  </div>
                  <div class="form-group">
                    <label class="col-sm-2 control-label"><span class="span-danger">*</span>权限设置:</label>
                    <div class="col-sm-10">
                      <div uib-auth all-authes="authes" role-auth="info.authes" disable="true"></div>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>

      <div ng-if="type === 'edit' && !loading">
        <div class="tools">
          <div class="btn-group" role="group" aria-label="">
            <a href="{{redirect_url}}" class="btn btn-default btn-info" uib-tooltip="返回" tooltip-append-to-body="true" tooltip-placement="top" ><i class="fa fa-fw fa-chevron-left"></i><span class="hidden-xs"> 返回</span></a>
          </div>
        </div>

        <div class="row mt-10">
          <div class="col-md-12">
            <div class="panel panel-default panel-csc">
              <div class="panel-heading">
                <div class="panel-title">编辑角色</div>
              </div>
              <div class="panel-body">
                <form name="form" class="form form-horizontal" ng-submit="editSubmit(id, form.$valid)" novalidate>
                  <!--<div class="form-group">
                    <label class="col-sm-2 control-label"><span class="span-danger">*</span>角色名称:</label>
                    <div class="col-sm-10">
                      <input type="text" ng-model="info.name" name="name" class="form-control" placeholder="角色名称" required>
                      <div class="error-messages" ng-messages="form.name.$error">
                        <small class="error" ng-message="required">请输入角色名称（*必填）</small>
                      </div>
                    </div>
                  </div>
                  <div class="form-group">
                    <label class="col-sm-2 control-label"><span class="span-danger">*</span>角色键值:</label>
                    <div class="col-sm-10">
                      <input type="text" ng-model="info.value" name="value" class="form-control" placeholder="角色键值" required>
                      <div class="error-messages" ng-messages="form.value.$error">
                        <small class="error" ng-message="required">请输入角色键值（*必填）</small>
                      </div>
                    </div>
                  </div>-->
                  <div class="form-group">
                    <label class="col-sm-2 control-label"><span class="span-danger">*</span>角色名称:</label>
                    <div class="col-sm-10">
                      <p class="form-control-static">{{info.name}}</p>
                    </div>
                  </div>
                  <div class="form-group">
                    <label class="col-sm-2 control-label"><span class="span-danger">*</span>角色键值:</label>
                    <div class="col-sm-10">
                      <p class="form-control-static">{{info.value || '未填写'}}</p>
                    </div>
                  </div>
                  <div class="form-group form-select-group">
                    <label class="col-sm-2 control-label"><span class="span-danger">*</span>角色描述:</label>
                    <div class="col-sm-10">
                      <textarea ng-model="info.desc" name="desc" class="form-control" placeholder="角色描述" required></textarea>
                      <div class="error-messages" ng-messages="form.desc.$error">
                        <small class="error" ng-message="required">请输入角色描述（*必填）</small>
                      </div>
                    </div>
                  </div>
                  <div class="form-group">
                    <label class="col-sm-2 control-label"><span class="span-danger">*</span>权限设置:</label>
                    <div class="col-sm-10">
                      <div uib-auth all-authes="authes" role-auth="info.authes"></div>
                    </div>
                  </div>

                  <div class="form-group">
                    <div class="col-sm-offset-2 col-sm-10">
                      <div class="btn-group" role="group" aria-label="">
                        <button class="btn btn-default btn-success" ng-disabled="form.$invalid"><i class="fa fa-fw fa-save"></i> 保存</button>
                      </div>
                      <div class="btn-group" role="group" aria-label="">
                        <a href="{{redirect_url}}" class="btn btn-default btn-danger"><i class="fa fa-fw fa-mail-forward"></i> 放弃</a>
                      </div>
                    </div>
                  </div>
                </form>
              </div>
            </div>
          </div>
        </div>
      </div>

    </div>
  </div>

</div>
